#include <bits/stdc++.h>

#define in read()
#define fi first
#define se second
#define pb push_back

using namespace std;

using pii = pair < int , int >;
using vec = vector < int >;
using veg = vector < pii >;
using ll = long long;
using db = double;

int read() {
    int x = 0; bool f = 0; char ch = getchar(); while(!isdigit(ch)) f |= ch == '-',ch = getchar();
    while(isdigit(ch)) x = x * 10 + (ch ^ 48),ch = getchar(); return f ? -x : x;
}

const int N = 110;

int n,Q;
int ans[N];

int query(vec x) {
	if(x.size() == 0) return 0;
	cout << "?" << " " << x.size(); for(auto d : x) cout << " " << d; cout << endl;
	int val; cin >> val; if(val == -1) exit(-1); return val;
}

int query(vec x,vec y) {
	for(auto d : x) y.pb(d); return query(y); 
}

void solve(int id,int mx,vec pot,vec apot) {
	if(pot.size() == 0) return;
	if(apot.size() == mx) return solve(id + 1,query(pot),pot,{});
	int l = 1,r = pot.size();
	while(l <= r) {
		int mid = l + r >> 1;
		if(query({pot.begin() + mid,pot.end()},apot) == mx) l = mid + 1;
		else r = mid - 1;
	}
	ans[pot[l - 1]] = id; apot.pb(pot[l - 1]);
	pot.erase(pot.begin() + l - 1);
	return solve(id,mx,pot,apot);
}

void solve() {
	cin >> n >> Q;
	vec pot; for(int i = 1;i <= n;i++) pot.pb(i),ans[i] = 0;
	solve(1,query(pot),pot,{});
	cout << "!"; for(int i = 1;i <= n;i++) cout << " " << ans[i] ; cout << endl;
	int x; cin >> x; if(x == 1) return; else if(x == -1) exit(0);
}

int main() {
	int t; cin >> t; for(;t;t--) solve();
}
